home *** CD-ROM | disk | FTP | other *** search
/ Aminet 32 / Aminet 32 (1999)(Schatztruhe)[!][Aug 1999].iso / Aminet / dev / c / SUPRALib.lha / SUPRALib / Developer / Source.ORG / RecDirFree.c < prev    next >
C/C++ Source or Header  |  1999-05-17  |  1KB  |  51 lines

  1. /****** RecDirFree *************************************************
  2. *
  3. *   NAME
  4. *       RecDirFree -- Unlocks all locked paths (V10)
  5. *       (dos V36)
  6. *
  7. *   SYNOPSIS
  8. *       void RecDirFree(RecDirInfo)
  9. *
  10. *       void RecDirFree(struct RecDirInfo *);
  11. *
  12. *   FUNCTION
  13. *       This function is called internally when error occurs in
  14. *       RecDirNext(), so you don't have to call it then!
  15. *       You can only call it when you no longer want to use RecDirNext(),
  16. *       before it finishes the scanning process.
  17. *       You DO NOT have to call RecDirFree() when you get any error,
  18. *       even DN_ERR_END (scanning process complete)!
  19. *
  20. *   INPUTS
  21. *       RecDirInfo - pointer to struct RecDirInfo which has been
  22. *                    called with RecDirInit()
  23. *
  24. *   RESULT
  25. *       none
  26. *
  27. *   SEE ALSO
  28. *       RecDirInit(), RecDirNext(), RecDirNextTagList()
  29. *
  30. *******************************************************************/
  31.  
  32. #include <proto/exec.h>
  33. #include <proto/dos.h>
  34. #include <exec/memory.h>
  35. #include <libraries/supra.h>
  36.  
  37. void RecDirFree(struct RecDirInfo *rdi)
  38. {
  39.     struct LockNode *ln;
  40.  
  41.     while (rdi->rdi_Deep > 0) {
  42.         ln = rdi->rdi_Node;
  43.         FreeMem(ln->ln_Path, ln->ln_Len);
  44.         FreeMem(ln->ln_FIB, sizeof(struct FileInfoBlock));
  45.         UnLock(ln->ln_Lock);
  46.         rdi->rdi_Node = ln->ln_Pred;
  47.         FreeMem(ln,sizeof(struct LockNode));
  48.         rdi->rdi_Deep--;
  49.     }
  50. }
  51.